Skip to content

Add diagnostic logging for AI metadata visibility issue in Vercel deployment#1105

Closed
Claude wants to merge 5 commits intomainfrom
claude/fix-ai-metadata-issue
Closed

Add diagnostic logging for AI metadata visibility issue in Vercel deployment#1105
Claude wants to merge 5 commits intomainfrom
claude/fix-ai-metadata-issue

Conversation

@Claude
Copy link
Copy Markdown
Contributor

@Claude Claude AI commented Apr 10, 2026

After Vercel deployment, Studio sidebar shows incomplete AI metadata (missing agents/tools). Root cause unknown—could be service registry callback failure, metadata service unavailability, or timing issues during bootstrap.

Changes

  • protocol.ts: Added console logging in getMetaTypes() and getMetaItems() to trace:

    • Services registry availability and size
    • Metadata service accessibility and method presence
    • Runtime types/items retrieval from metadata service
    • Final merged result counts
  • plugin.ts: Fixed ObjectStackProtocolImplementation initialization to include missing feed service callback (3rd constructor parameter)

Diagnostic Flow

// protocol.ts - Now logs each step
async getMetaTypes() {
  const services = this.getServicesRegistry?.();
  console.log('[Protocol] services available:', !!services, 'size:', services?.size);
  
  const metadataService = services?.get('metadata');
  console.log('[Protocol] metadata service:', !!metadataService);
  
  if (metadataService?.getRegisteredTypes) {
    const runtimeTypes = await metadataService.getRegisteredTypes();
    console.log('[Protocol] runtime types:', runtimeTypes);
  }
}

This will expose whether the issue is in service registry access, metadata service registration, or the metadata itself. Once Vercel logs are available, a targeted fix can be implemented.

- Add detailed console.log statements in protocol.ts getMetaTypes() and getMetaItems()
- Fix protocol initialization to include feed service callback
- Log services registry availability, metadata service access, and item counts
- This will help diagnose why AI metadata (agents/tools) are missing in Studio sidebar after Vercel deployment

Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/7c8d308d-1490-4439-81f9-65605addcbb5

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
objectstack-play Ready Ready Preview, Comment Apr 11, 2026 5:17am
spec Ready Ready Preview, Comment Apr 11, 2026 5:17am

Request Review

- Create local integration test to verify protocol metadata service logic
- Test confirms getServicesRegistry callback works correctly
- Test confirms metadata service methods are called and items are merged
- Add comprehensive TEST_REPORT.md documenting test results and expected behavior
- All tests pass, backward compatibility maintained

Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/d5b8630b-8471-4271-9799-d74454a96ed8

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
**Root Cause:**
Protocol callback captured PluginContext during ObjectQLPlugin.init(), but MetadataPlugin
registers its service AFTER ObjectQLPlugin. This meant ctx.getServices() returned a snapshot
without the metadata service, causing agents/tools to be invisible in Studio sidebar.

**Fix:**
Changed protocol initialization to access kernel.context.getServices() dynamically at request
time instead of capturing ctx.getServices() during init. This ensures the protocol always
accesses the live services registry with all registered services including MetadataService.

**Changes:**
- ObjectQLPlugin: Use ctx.getKernel() to get kernel reference, access services via kernel.context
- Protocol: Removed diagnostic logging (no longer needed)
- AIServicePlugin: Removed diagnostic logging
- MetadataPlugin: Removed diagnostic logging

**Verified:**
- Protocol now accesses services dynamically at runtime
- MetadataService is accessible even though it registers after ObjectQLPlugin
- Agents and tools should now be visible in Studio sidebar on Vercel

Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/8252cffa-ca7f-44e7-9646-e56ed9b05e6a

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
…operty

Replace direct access to kernel.context (private property) with public
kernel.getService() method. The protocol now probes for known services
at runtime to build a fresh service map, ensuring metadata service is
accessible when needed.

Related to AI metadata visibility fix.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
The previous fix attempted to probe for services using a hardcoded list,
which missed services not in the list. The correct solution is simpler:
ctx.getServices() returns a fresh snapshot of ALL services each time it's
called (see kernel.ts:144-145), so we can just pass it as a callback.

This ensures the protocol has access to all services registered after
ObjectQLPlugin's init() phase, including metadata service (for agents/tools)
and AI service, which are registered by later plugins.

Root cause: Protocol was capturing ctx.getServices() result during init()
instead of calling it at runtime. Now fixed by passing the function itself.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m size/s

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants